package addlatch
import "sync"

type Addlatch struct {
				c chan int
			 List [] interface{}
				target int
				lock sync.Mutex
}

func(c *Addlatch) Add(o interface{})  {
				c.lock.Lock()
				c.List= append(c.List, o)
				if len(c.List)== c.target {
								c.c<-1
				}
				c.lock.Unlock()
}
func(c *Addlatch) Wait()  {
				<-c.c
}
func GetInstance(target int) *Addlatch {
				c := &Addlatch{}
				c.List=[]interface{}{}
				c.target=target
				c.c=make(chan int, 1)
				return  c
}
